<template>
	<view class="container">
		<form>
			<view class="input-row">
				<view style="width: 200rpx;">巡查工地：</view>
				<picker disabled="true" style="width: 450rpx;text-align: center;" @change="bindProtectChanges"
					range-key="cn" :data-index="22" :data-id="cprojects[cprojectIndex].id" :value="cprojectIndex"
					:range="cprojects">
					<view class="uni-input">{{cprojects[cprojectIndex].cn}}</view>
					<input type="text" :value="cprojects[presultindex].id" hidden />
				</picker>
			</view>
			<view class="input-row">
				<view style="width: 200rpx;">巡查模式：</view>
				<picker style="width: 500rpx;text-align: center;" :disabled="isUpdate" @change="bindPickerChanges"
					range-key="cn" :data-index="22" :data-id="pModes[index].id" :value="index" :range="pModes">
					<view class="uni-input">{{pModes[index].cn}}</view>
					<input type="text" :value="pModes[index].id" hidden />
				</picker>
			</view>
			<view class="input-row">
				<view style="width: 200rpx;">巡查类型：</view>
				<picker style="width: 500rpx;text-align: center;" disabled="true" @change="bindptypesChanges"
					range-key="cn" :data-index="22" :data-id="ptypes[ptypeindex].id" :value="ptypeindex"
					:range="ptypes">
					<view class="uni-input">{{ptypes[ptypeindex].cn}}</view>
					<input type="text" :value="ptypes[ptypeindex].id" hidden />
				</picker>
			</view>

			<view class="input-row">
				<view style="width: 200rpx;">巡查人2：</view>
				<input disabled="true" style="width: 500rpx;text-align: center;" type="text" v-model="pman2" />
			</view>
			<view class="input-row">
				<view style="width: 200rpx;">周期：</view>
				<input :disabled="isUpdate" style="width: 500rpx;text-align: center;" type="number" v-model="cycle" />天
			</view>
			<view class="input-row">
				<view style="width: 200rpx;">流程节点：</view>
				<input disabled="true" style="width: 500rpx;text-align: center;" type="text" v-model="rf_flow_node" />
			</view>
			<view class="input-row" v-if="deny_rs_level2!=null">
				<view style="width: 200rpx;">整改不通过二级意见 ：</view>
				<textarea disabled="true" style="width: 500rpx;text-align: center;" type="text"
					v-model="deny_rs_level2" />
			</view>
			<view class="input-row" v-if="deny_rs_level3!=null">
				<view style="width: 200rpx;">整改不通过三级意见 ：</view>
				<textarea disabled="true" style="width: 500rpx;text-align: center;" type="text"
					v-model="deny_rs_level3" />
			</view>
			<view class="input-row" v-if="deny_recheck_level1!=null">
				<view style="width: 200rpx;">复查不通过一级意见 ：</view>
				<textarea disabled="true" style="width: 500rpx;text-align: center;" type="text"
					v-model="deny_recheck_level1" />
			</view>
			<view class="input-row" v-if="deny_recheck_level2!=null">
				<view style="width: 200rpx;">复查不通过二级意见 ：</view>
				<textarea disabled="true" style="width: 500rpx;text-align: center;" type="text"
					v-model="deny_recheck_level2" />
			</view>
			<view v-if="ptype=='03'">
				<view class="input-row">
					<view style="width: 220rpx;">建设方负责人：</view>
					<picker style="width: 500rpx;text-align: center;" @change="bindIsexistMcmanChanges" range-key="cn"
						:data-index="22" :data-id="isexist_mcmans[isexist_mcmansindex].id" :value="isexist_mcmansindex" :range="isexist_mcmans">
						<view class="uni-input">{{isexist_mcmans[isexist_mcmansindex].cn}}</view>
						<input type="text" :value="isexist_mcmans[isexist_mcmansindex].id" hidden />
					</picker>
				</view>
				<view class="input-row">
					<view style="width: 220rpx;">施工方负责人：</view>
					<picker style="width: 500rpx;text-align: center;" @change="bindIsexistBcmanChanges" range-key="cn"
						:data-index="22" :data-id="isexist_bcmans[isexist_bcmansindex].id" :value="isexist_bcmansindex" :range="isexist_bcmans">
						<view class="uni-input">{{isexist_bcmans[isexist_bcmansindex].cn}}</view>
						<input type="text" :value="isexist_bcmans[isexist_bcmansindex].id" hidden />
					</picker>
				</view>
				<view class="input-row">
					<view style="width: 220rpx;">监理方负责人：</view>
					<picker style="width: 500rpx;text-align: center;" @change="bindIsexistSvmanChanges" range-key="cn"
						:data-index="22" :data-id="isexist_svmans[isexist_svmansindex].id" :value="isexist_svmansindex" :range="isexist_svmans">
						<view class="uni-input">{{isexist_svmans[isexist_svmansindex].cn}}</view>
						<input type="text" :value="isexist_svmans[isexist_svmansindex].id" hidden />
					</picker>
				</view>
			</view>
			
			<view class="input-row">
				<view style="width: 200rpx;">得分：</view>
				<input disabled="true" style="width: 500rpx;text-align: center;" type="text" v-model="totalscore" />
			</view>
			<!-- <view class="input-row">
				<view style="width: 200rpx;">当前处理人：</view>
				<input disabled="true" style="width: 500rpx;text-align: center;" type="text" v-model="chman" />
			</view>
			<view class="input-row">
				<view style="width: 200rpx;">处理人电话：</view>
				<input disabled="true" style="width: 500rpx;text-align: center;" type="text" v-model="chman" />
			</view> -->
			<view class="input-row">
				<view style="width: 200rpx;">巡查结果：</view>
				<picker :disabled="isUpdate" style="width: 500rpx;text-align: center;" @change="bindPresultChanges"
					range-key="cn" :data-index="22" :data-id="presults[presultindex].id" :value="presultindex"
					:range="presults">
					<view class="uni-input">{{presults[presultindex].cn}}</view>
					<input type="text" :value="presults[presultindex].id" hidden />
				</picker>
			</view>
			<view style="margin-top: 20rpx;">
				<button class='submit-btn' v-if="userInfo.role.name=='市场监督员'||userInfo.role.name=='安全监督员'||userInfo.role.name=='质量监督员'" @click="submitForm">保存</button>
			</view>
			<view style="margin-top: 20rpx;">
				<button class='submit-btn' @click="goCpatrolDetail()">查看巡查单明细</button>
			</view>
			<view style="margin-top: 20rpx;">
				<button class='submit-btn' @click="goReform()">查看整改明细单</button>
			</view>
			<view style="margin-top: 20rpx;">
				<button v-if="userInfo.role.name=='市场监督员'||userInfo.role.name=='安全监督员'||userInfo.role.name=='质量监督员'" class='submit-btn' @click="reform()">提交限期整改</button>
			</view>
			<view style="margin-top: 20rpx;">
				<button
					v-if="(userInfo.role.name=='市场科负责人'||userInfo.role.name=='质监科负责人'||userInfo.role.name=='安全科负责人')"
					class='submit-btn' @click="approved2()">限期整改二级审批通过</button>
			</view>
			<view style="margin-top: 20rpx;">
				<button
					v-if="(userInfo.role.name=='市场科负责人'||userInfo.role.name=='质监科负责人'||userInfo.role.name=='安全科负责人')"
					class='submit-btn' @click="reject2()">限期整改二级驳回</button>
			</view>
			<view style="margin-top: 20rpx;">
				<button v-if="userInfo.role.name=='工地负责人'||userInfo.role.name=='工地质量负责人'" class='submit-btn' @click="uploadReform()">整改处理上传</button>
			</view>
			<view style="margin-top: 20rpx;">
				<button v-if="userInfo.role.name=='市场监督员'||userInfo.role.name=='安全监督员'||userInfo.role.name=='质量监督员' " class='submit-btn' @click="review1Pass()">一级复查通过</button>
			</view>
			<view style="margin-top: 20rpx;">
				<button v-if="userInfo.role.name=='市场监督员'||userInfo.role.name=='安全监督员'||userInfo.role.name=='质量监督员'" class='submit-btn' @click="review1reject()">一级复查驳回</button>
			</view>
			<view style="margin-top: 20rpx;">
				<button
					v-if="(userInfo.role.name=='市场科负责人'||userInfo.role.name=='质监科负责人'||userInfo.role.name=='安全科负责人')"
					class='submit-btn' @click="review2Pass()">二级复查通过</button>
			</view>
			<view style="margin-top: 20rpx;">
				<button
					v-if="(userInfo.role.name=='市场科负责人'||userInfo.role.name=='质监科负责人'||userInfo.role.name=='安全科负责人')"
					class='submit-btn' @click="review2reject()">二级复查驳回</button>
			</view>
			<view style="margin-top: 20rpx;">
				<button class='submit-btn' @click="getScore()">计算行政检查单得分</button>
			</view>
		</form>
	</view>
</template>

<script>
	import {
		request
	} from '@/request/index.js';
	export default {
		data() {
			return {
				isUpdate: true,
				cycle: 30,
				pman2: '',
				pphoto1: '',
				pphoto2: '',
				pmode: '',
				pModes: [],
				index: 0,
				ptypes: [],
				ptypeindex: 0,
				ptype: '',
				presult: '',
				presults: [],
				presultindex: 0,
				cproject: '',
				cprojects: [],
				cprojectIndex: 0,
				project: '',
				userInfo: {},
				detailList: [],
				cprojectId: '',
				pid: '',
				chman_val: '',
				chman:'',
				rf_flow_node_val: '',
				rf_flow_node: '',
				totalscore: '',
				deny_rs_level2: '',
				deny_rs_level3: '',
				deny_recheck_level1: '',
				deny_recheck_level2: '',
				isexist_mcmans: [{"cn":"在岗","id":"1"},{"cn":"不在岗","id":"2"}],
				isexist_mcmansindex:0,
				isexist_mcman:'1',
				isexist_bcmans:[{"cn":"在岗","id":"1"},{"cn":"不在岗","id":"2"}],
				isexist_bcmansindex:0,
				isexist_bcman:'1',
				isexist_svmans:[{"cn":"在岗","id":"1"},{"cn":"不在岗","id":"2"}],
				isexist_svmansindex:0,
				isexist_svman:'1'
			};
		},
		onShow() {
			this.getDetailInfo()
		},
		onLoad(option) {
			var userInfo = uni.getStorageSync('user');
			// if (userInfo == null || userInfo == 'null' || userInfo == '') {
			// 	uni.showModal({
			// 		title: "请先登录",
			// 		success() {
			// 			uni.reLaunch({
			// 				url: "/pages/login/login"
			// 			})
			// 		}
			// 	})

			// }
			var _self = this;
			_self.userInfo = userInfo
			if (userInfo.role.name=='市场监督员'||userInfo.role.name=='安全监督员'||userInfo.role.name=='质量监督员') {
				this.isUpdate = false
			}


			this.pid = option.pid
			this.ptype = option.ptype

			this.getPmode()
			this.getPresults()
			this.getProjects()
			this.getTypes()
			this.getDetailInfo()

		},
		onPullDownRefresh() {
			this.getDetailInfo()
		},
		methods: {
			bindIsexistMcmanChanges(e){
				this.isexist_mcmansindex = e.target.value
				this.isexist_mcman = this.isexist_mcmans[this.isexist_mcmansindex].id
			},
			bindIsexistBcmanChanges(e){
				this.isexist_bcmansindex = e.target.value
				this.isexist_bcman = this.isexist_bcmans[this.isexist_bcmansindex].id
			},
			bindIsexistSvmanChanges(e){
				this.isexist_svmansindex = e.target.value
				this.isexist_svman = this.isexist_svmans[this.isexist_svmansindex].id
			},
			bindPickerChanges(e) {
				this.index = e.target.value
				this.pmode = this.pModes[this.index].id
			},
			bindPresultChanges(e) {

				this.presultindex = e.target.value
				this.presult = this.presults[this.presultindex].id
			},
			bindProtectChanges(e) {
				this.cprojectIndex = e.target.value
				this.cproject = this.cprojects[this.cprojectIndex].id
			},
			bindptypesChanges(e) {
				this.ptypeindex = e.target.value
				this.ptype = this.ptypes[this.ptypeindex].id
			},
			removeDetail(index) {


				this.detailList.splice(index, 1);
			},
			getScore() {
				var that = this
				request({
					url: "/patrol2/ComputePatrolScore?pids=" + that.pid,
					method: "GET",
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'cookie': uni.getStorageSync('cookie')
					}
				}).then(res => {

					if (res.data.code == '200') {
						this.getDetailInfo()
					} else {
						uni.showModal({
							content: res.data.msg,
						})
					}
				})
			},
			async getDetailInfo() {
				var data = {}
				var that = this
				data.query_pid = that.pid
				var uri = ""
				if (this.ptype == '01') {
					uri = "/thirdGrid/query/c_cpatrol-m_cpatrol"
				}
				if (this.ptype == '02') {
					uri = "/thirdGrid/query/c_spatrol-m_spatrol"
				}
				if (this.ptype == '03') {
					uri = "/thirdGrid/query/c_qpatrol-m_qpatrol"
				}
				request({
					url: uri,
					method: "POST",
					data: data,
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'cookie': uni.getStorageSync('cookie')
					}
				}).then(res => {

					if (res.data.success) {
						if (res.data.rows.length > 0) {
							var d = res.data.rows[0]
							for (var i = 0; i < this.cprojects.length; i++) {
								if (d.cproject_val == this.cprojects[i].id) {
									this.cprojectIndex = i
									this.cproject = this.cprojects[this.cprojectIndex].id
								}
							}
							for (var i = 0; i < this.pModes.length; i++) {
								if (d.pmode_val == this.pModes[i].id) {
									this.index = i
									this.pmode = this.pModes[this.index].id
								}
							}
							for (var i = 0; i < this.presults.length; i++) {
								if (d.presult_val == this.presults[i].id) {
									this.presultindex = i
									this.presult = this.presults[this.presultindex].id
								}
							}
							for (var i = 0; i < this.ptypes.length; i++) {
								if (d.ptype_val == this.ptypes[i].id) {
									this.ptypeindex = i
									this.ptype = this.ptypes[this.ptypeindex].id
								}
							}
							for (var i = 0; i < this.isexist_mcmans.length; i++) {
								if (d.isexist_mcman_val == this.isexist_mcmans[i].id) {
									this.isexist_mcmansindex = i
									this.isexist_mcman = this.isexist_mcmans[this.isexist_mcmansindex].id
								}
							}
							for (var i = 0; i < this.isexist_bcmans.length; i++) {
								if (d.isexist_bcman_val == this.isexist_bcmans[i].id) {
									this.isexist_bcmansindex = i
									this.isexist_bcman = this.isexist_bcmans[this.isexist_bcmansindex].id
								}
							}
							for (var i = 0; i < this.isexist_svmans.length; i++) {
								if (d.isexist_svman_val == this.isexist_svmans[i].id) {
									this.isexist_svmansindex = i
									this.isexist_svman = this.isexist_svmans[this.isexist_svmansindex].id
								}
							}
							
							
							
							
							this.chman_val = d.chman_val
							this.chman = d.chman
							this.rf_flow_node_val = d.rf_flow_node_val
							this.pman2 = d.pman2
							this.rf_flow_node = d.rf_flow_node
							this.totalscore = d.totalscore
							this.deny_rs_level2 = d.deny_rs_level2
							this.deny_rs_level3 = d.deny_rs_level3
							this.deny_recheck_level1 = d.deny_recheck_level1
							this.deny_recheck_level2 = d.deny_recheck_level2,
							this.isexist_mcman = d.isexist_mcman_val
							this.isexist_bcman = d.isexist_bcman_val
							this.isexist_svman = d.isexist_svman_val
							
						}

					} else {
						uni.showModal({
							title: res.data.msg,
						})
					}
				})
			},


			updatecip() {
				var data = {}
				var that = this
				var location = uni.getStorageSync("location")
				
				// 使用工具函数验证并修正坐标值
				const { validateCoordinates } = require('@/utils/index.js');
				const coords = validateCoordinates(location?.latitude, location?.longitude);
				
				data.longitude = coords.longitude;
				data.latitude = coords.latitude;
				data.cproject = that.cproject
				data.pmode = that.pmode
				data.pman2 = that.userInfo.user.id
				data.presult = that.presult
				data.ptype = that.ptype
				data.presult = that.presult
				data.cycle = that.cycle
				data.pid = that.pid
				
				var uri = ""
				if (this.ptype == '01') {
					uri = "/thirdForm/doUpdate/c_cpatrol"
				}
				if (this.ptype == '02') {
					uri = "/thirdForm/doUpdate/c_spatrol"
				}
				if (this.ptype == '03') {
					uri = "/thirdForm/doUpdate/c_qpatrol"
					data.isexist_mcman = that.isexist_mcman
					data.isexist_bcman = that.isexist_bcman
					data.isexist_svman = that.isexist_svman
				}
				
				request({
					url: uri,
					method: "POST",
					data: data,
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'cookie': uni.getStorageSync('cookie')
					}
				}).then(res => {

					if (res.data.code == '200') {
						// const pages = getCurrentPages();
						// 	const prevPage = pages[pages.length - 2]; // 上一个页面
						// 	// uni.$u.toast('操作成功');
						// 	setTimeout(() => {
						// 		uni.navigateBack({
						// 			delta: 1,
						// 			success: () => {
						// 				prevPage.$vm.getCpatrol(); // 直接调用上个页面的刷新方法
						// 			}
						// 		});
						// 	}, 500);
						uni.redirectTo({
							url: "/pages/cpatrol/cpatrol?ptype=" + this.ptype
						})
					} else {
						uni.showModal({
							title: res.data.msg,

						})
					}
				})
			},

			async getPmode() {
				var that = this
				request({
					url: "/thirdWidget/comboJson/c_cpatrol-pmode",
					method: "POST",
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'cookie': uni.getStorageSync('cookie')
					}
				}).then(res => {

					if (res.data.code == '200') {
						that.pModes = []
						for (var i = 0; i < res.data.data.length; i++) {

							var mode = {}
							mode.id = res.data.data[i].id
							mode.cn = res.data.data[i].cn
							if (mode.id != '') {
								that.pModes.push(mode)
							}

						}
						that.pmode = that.pModes[that.index].id
					} else {
						uni.showModal({
							content: res.data.msg,

						})
					}
				})
			},
			async getTypes() {
				var that = this
				request({
					url: "/thirdWidget/comboJson/c_cpatrol-ptype",
					method: "POST",
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'cookie': uni.getStorageSync('cookie')
					}
				}).then(res => {

					if (res.data.code == '200') {
						that.ptypes = []
						for (var i = 0; i < res.data.data.length; i++) {

							var mode = {}
							mode.id = res.data.data[i].id
							mode.cn = res.data.data[i].cn
							if (mode.id != '') {
								that.ptypes.push(mode)
							}

						}
						that.ptype = that.ptypes[that.ptypeindex].id
					} else {
						uni.showModal({
							content: res.data.msg,

						})
					}
				})
			},
			async getPresults() {
				var that = this
				request({
					url: "/thirdWidget/comboJson/c_cpatrol-presult",
					method: "POST",
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'cookie': uni.getStorageSync('cookie')
					}
				}).then(res => {

					if (res.data.code == '200') {
						that.presults = []
						for (var i = 0; i < res.data.data.length; i++) {

							var result = {}
							result.id = res.data.data[i].id
							result.cn = res.data.data[i].cn
							if (result.id != '') {
								that.presults.push(result)
							}

						}
						that.presult = that.presults[that.presultindex].id

					} else {
						uni.showModal({
							content: res.data.msg,

						})
					}
				})
			},
			async getProjects() {
				var that = this
				request({
					url: "/thirdWidget/findJson?code=c_cpatrol&field=cproject",
					method: "POST",
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'cookie': uni.getStorageSync('cookie')
					}
				}).then(res => {

					if (res.data.success == true) {
						that.cprojects = []
						for (var i = 0; i < res.data.rows.length; i++) {
							var project = {}
							project.id = res.data.rows[i].cpid
							project.cn = res.data.rows[i].csname
							that.cprojects.push(project)
							if (project.id == that.cprojectId) {
								that.cprojectIndex = i
							}
						}
						that.cproject = that.cprojects[that.cprojectIndex].id

					} else {
						uni.showModal({
							content: res.data.msg,

						})
					}
				})
			},
			submitForm() {
				// 这里可以添加提交表单的逻辑
				this.updatecip()
			},
			godetail() {
				uni.redirectTo({
					url: "/pages/sipdetail/sipdetail"
				})
			},
			chooseImg1() {
				var that = this
				uni.chooseImage({
					count: 1, // 默认9，设置图片的数量
					sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
					success: (chooseImageRes) => {
						const tempFilePaths = chooseImageRes.tempFilePaths;

						that.pphoto1 = tempFilePaths[0]
						const uploadTask = uni.uploadFile({
							url: 'https://qscs.qtech2000.cn:8443/thirdUpload/img?name=pphoto1_file', // 开发者服务器的URL
							filePath: tempFilePaths[0],
							name: 'pphoto1_file', // 必填，文件对应的 key
							header: {
								'cookie': uni.getStorageSync('cookie')
							},
							success: (uploadFileRes) => {

								that.pphoto1 = uploadFileRes.data.data.fileName
							},
							fail: (uploadFileErr) => {

							}
						});
						// 监听上传进度变化
						uploadTask.onProgressUpdate((res) => {

						});
					},
					fail: (chooseImageErr) => {
						console.error('choose image fail:', chooseImageErr);
					}
				});
			},
			chooseImg2() {
				var that = this
				uni.chooseImage({
					count: 1, // 默认9，设置图片的数量
					sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
					success: (chooseImageRes) => {
						const tempFilePaths = chooseImageRes.tempFilePaths;

						that.pphoto2 = tempFilePaths[0]
						const uploadTask = uni.uploadFile({
							url: 'https://qscs.qtech2000.cn:8443/thirdUpload/img?name=pphoto2_file', // 开发者服务器的URL
							filePath: tempFilePaths[0],
							name: 'pphoto2_file', // 必填，文件对应的 key
							success: (uploadFileRes) => {

								that.pphoto2 = uploadFileRes.data.data.fileName
							},
							fail: (uploadFileErr) => {
								// console.error('upload fail:', uploadFileErr);
							}
						});
						//监听上传进度变化
						uploadTask.onProgressUpdate((res) => {

						});
					},
					fail: (chooseImageErr) => {
						console.error('choose image fail:', chooseImageErr);
					}
				});
			},
			goReform() {
				uni.redirectTo({
					url: "/pages/reform/reform?pid=" + this.pid + "&ptype=" + this.ptype
				})
			},
			//提交限期整改
			reform() {
				var data = {}
				data = {
					pids: this.pid
				}
				request({
					url: "/patrol2/limitRectifySubmit",
					method: "POST",
					data: data,
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'cookie': uni.getStorageSync('cookie')
					}
				}).then(res => {
					if (res.data.success == true) {
						uni.showModal({
							content: '操作成功',
						})
						this.getDetailInfo()
					} else {
						uni.showModal({
							content: res.data.msg,

						})
					}
				})
			},
			//二级审核通过
			approved2() {
				var data = {}
				data = {
					pids: this.pid
				}
				request({
					url: "/patrol2/limitRectifyPass2",
					method: "POST",
					data: data,
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'cookie': uni.getStorageSync('cookie')
					}
				}).then(res => {

					if (res.data.success == true) {
						uni.showModal({
							content: '操作成功',
						})
						this.getDetailInfo()
					} else {
						uni.showModal({
							content: res.data.msg,
						})
					}
				})
			},
			reject2() {
				var data = {}
				uni.redirectTo({
					url: "/pages/reject2/reject2?pid=" + this.pid+"&ptype="+this.ptype
				})
			},
			//一级复查通过
			review1Pass() {
				var data = {}
				data = {
					pids: this.pid
				}
				request({
					url: "/patrol2/checkLimitRectifyPass1",
					method: "POST",
					data: data,
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'cookie': uni.getStorageSync('cookie')
					}
				}).then(res => {

					if (res.data.success == true) {
						uni.showModal({
							content: '操作成功',
						})
						this.getDetailInfo()
					} else {
						uni.showModal({
							content: res.data.msg,

						})
					}
				})
			},
			//一级复查驳回
			review1reject() {
				uni.redirectTo({
					url: "/pages/review1reject/review1reject?pid=" + this.pid + "&ptype=" + this.ptype
				})
			},


			//二级复查通过
			review2Pass() {
				var data = {}
				data = {
					pids: this.pid
				}
				request({
					url: "/patrol2/checkLimitRectifyPass2",
					method: "POST",
					data: data,
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'cookie': uni.getStorageSync('cookie')
					}
				}).then(res => {
					if (res.data.success == true) {
						uni.showModal({
							content: '操作成功',
						})
						this.getDetailInfo()
					} else {
						uni.showModal({
							content: res.data.msg,

						})
					}
				})
			},
			//二级复查驳回
			review2reject() {

				uni.redirectTo({
					url: "/pages/review2reject/review2reject?pid=" + this.pid + "&ptype=" + this.ptype
				})
			},
			uploadReform() {
				var data = {}
				data = {
					pids: this.pid
				}
				request({
					url: "/patrol2/handleRectify1",
					method: "POST",
					data: data,
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'cookie': uni.getStorageSync('cookie')
					}
				}).then(res => {

					if (res.data.success == true) {
						uni.showModal({
							content: '操作成功',
						})
						this.getDetailInfo()
					} else {
						uni.showModal({
							content: res.data.msg,

						})
					}
				})
			},
			//查看明细
			goCpatrolDetail() {

				uni.redirectTo({
					url: "/pages/cpatrol_detail/cpatrol_detail?pid=" + this.pid + "&ptype=" + this.ptype
				})
			},
		},



	};
</script>

<style>
	.container {
		padding: 20px;
	}

	.input-row {
		margin-bottom: 15px;
		display: flex;

	}

	.input-row text {
		flex-grow: 1;
		margin-right: 10px;
	}

	.submit-btn {
		background-color: #00aaff;
		color: #fff;
	}
</style>